const { defineConfig } = require("@vue/cli-service");
const config = require("./vue.set");
const packageName = require("./package.json").name;
const dev = process.env.NODE_ENV === "development";
module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: dev ? "/" : `/${config.publicPath}`,
  devServer: {
    port: config.port, //这里的端口是必须和父应用配置的子应用端口一致
    headers: {
      //因为qiankun内部请求都是fetch来请求资源，所以子应用必须允许跨域
      "Access-Control-Allow-Origin": "*",
    },
  },
  configureWebpack: {
    output: {
      library: `${packageName}-[name]`,
      libraryTarget: "umd",
    },
  },
});
